The Church-Scott representation of inductive and coinductive data
نویسنده
چکیده
Data in the lambda calculus is usually represented using the "Church encoding", which gives closed terms for the constructors and which naturally allows to define functions by iteration. An additional nice feature is that in system F (polymorphically typed lambda calculus) one can define types for this data and the iteration scheme is well-typed. A problem is that primitive recursion is not directly available: it can be coded in terms of iteration at the cost of inefficiency (e.g. a predecessor with linear run-time). The much less well-known Scott encoding has case distinction as a primitive. The terms are not typable in system F and there is no iteration scheme, but there is a constant time destructor (e.g. predecessor). We present a unification of the Church and Scott definition of data types, the Church-Scott encoding, which has primitive recursion as basic. For the numerals, these are also known as ‘Parigot numerals’. We show how these can be typed in the polymorphic lambda calculus extended with recursive types. We show that this also works for the dual case, co-inductive data types with primitive co-recursion. We single out the major schemes for defining functions over data-types: the iteration scheme, the case scheme and the primitive recursion scheme, and we show how they are tightly connected to the Church, the Scott and the Church-Scott representation. We also single out the duals of these schemes: co-iteration, co-case and primitive co-recursion as schemes for defining function to a co-data-type. A major advantage is that all these are encodings in pure untyped λ-calculus and that strong normalization is guaranteed, because the terms are typable in the polymorphic lambda calculus extended with recursive types. 1998 ACM Subject Classification F.1.1 Models of Computation, D.1.1 Applicative (Functional) Programming, D.3.3 Language Constructs and Features, F.4.1 Mathematical Logic, F.3.3 Studies of Program Constructs
منابع مشابه
Call-by-Value and Call-by-Name Dual Calculi with Inductive and Coinductive Types
This paper extends the dual calculus with inductive types and coinductive types. The paper first introduces a non-deterministic dual calculus with inductive and coinductive types. Besides the same duality of the original dual calculus, it has the duality of inductive and coinductive types, that is, the duality of terms and coterms for inductive and coinductive types, and the duality of their re...
متن کاملCoinductive Models of Finite Computing Agents
This paper explores the role of coinductive methods in modeling finite interactive computing agents. The computational extension of computing agents from algorithms to interaction parallels the mathematical extension of set theory and algebra from inductive to coinductive models. Maximal fixed points are shown to play a role in models of observation that parallels minimal fixed points in induct...
متن کاملSubtyping-Based Type-Checking for System F with Induction and Coinduction
We present a type system with subtyping for a strongly normalizing, Curry-style language. Our type constructors include sum and product types, universal and existential quantifiers, inductive and coinductive types. Soundness and strong normalization are shown semantically by constructing a realizability model. We argue that the system is suitable for practical use based on our experience with a...
متن کاملGlobal semantic typing for inductive and coinductive computing
Inductive and coinductive types are commonly construed as ontological (Church-style) types, denoting canonical data-sets such as natural numbers, lists, and streams. For various purposes, notably the study of programs in the context of global (“uninterpreted”) semantics, it is preferable to think of types as semantical properties (Curry-style). Intrinsic theories were introduced in the late 199...
متن کاملA fixedpoint approach to (co)inductive and (co)datatype definitions
This paper presents a fixedpoint approach to inductive definitions. Instead of using a syntactic test such as “strictly positive,” the approach lets definitions involve any operators that have been proved monotone. It is conceptually simple, which has allowed the easy implementation of mutual recursion and iterated definitions. It also handles coinductive definitions: simply replace the least f...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 2014